home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / pgp20src.zip / KEYMGMT.H < prev    next >
C/C++ Source or Header  |  1992-08-11  |  4KB  |  94 lines

  1. /* keymgmt.h - headers for keymgmt.c 
  2. */
  3.  
  4. /*    Return printable public key fragment. */
  5. char *keyIDstring(byte *keyID);
  6. char *key2IDstring(unitptr n);
  7.  
  8. /* Do an RSA key pair generation, and write them out to the keyring files. */
  9. int dokeygen(char *numstr, char *numstr2);
  10.  
  11. /* Edit the userid and/or pass phrase for an RSA key pair, and put them    back
  12.    into the ring files */
  13. int dokeyedit(char *mcguffin, char *ringfile);
  14.  
  15. /* Copy the first entry in key ring that has mcguffin string in userid and
  16.    put it into keyfile */
  17. int extract_from_keyring (char *mcguffin, char *keyfile, char *ringfile,
  18.                           boolean transflag);
  19.  
  20. /* Lists all entries in keyring that have mcguffin string in userid */
  21. int view_keyring(char *mcguffin, char *ringfile, boolean show_signatures);
  22.  
  23. /* Signature-check all entries in keyring that have mcguffin string in userid */
  24. /* or if chk_keyID is not NULL, all signatures made by the key with this keyID */
  25. int dokeycheck(char *mcguffin, char *ringfile, byte *chk_keyID);
  26.  
  27. /* Allow user to remove signatures from keys in keyring that have mcguffin */
  28. int remove_sigs(char *mcguffin, char *ringfile);
  29.  
  30. /* Remove the first entry in key ring that has mcguffin string in userid */
  31. int remove_from_keyring(byte *keyID, char *mcguffin, char *ringfile);
  32.  
  33. /* Adds (prepends) key file to key ring file */
  34. int addto_keyring(char *keyfile, char *ringfile, boolean query);
  35.  
  36. /* Extract key fragment from modulus n */
  37. void extract_keyID(byteptr keyID, unitptr n);
  38.  
  39. /* Write message prefix keyID to a file */
  40. void writekeyID(unitptr n, FILE *f);
  41.  
  42. /* Extract public key corresponding to keyID or userid from keyfile */
  43. int getpublickey(boolean giveup, boolean showkey, char *keyfile,
  44.                  long *file_position, int *pktlen, byte *keyID,
  45.                  byte *timestamp, byte *userid, unitptr n, unitptr e);
  46.  
  47. /* Extract private key corresponding to keyID or userid from keyfile */
  48. int getsecretkey(boolean giveup, boolean showkey, char *keyfile, byte *keyID,
  49.                  byte *timestamp, char *passp, boolean *hkey, byte *userid,
  50.                  unitptr n, unitptr e, unitptr d, unitptr p, unitptr q,
  51.                  unitptr u);
  52.  
  53. /* Return true if ctb is one for a key in a keyring */
  54. int is_key_ctb (byte ctb);
  55.  
  56. /* Read next key packet from file f, return its ctb in *pctb, and advance
  57.  * the file pointer to point beyond the key packet.
  58.  */
  59. short nextkeypacket(FILE *f, byte *pctb);
  60.  
  61. /* Read the next key packet from file f, return info about it in the various
  62.  * pointers.  Most pointers can be NULL without breaking it.
  63.  */
  64. short readkeypacket(FILE *f, boolean hidekey, byte *pctb,
  65.     byte *timestamp, char *userid,
  66.     unitptr n ,unitptr e, unitptr d, unitptr p, unitptr q, unitptr u,
  67.     byte *sigkeyID, byte *keyctrl);
  68.  
  69. /* Starting at key_position in keyfile, scan for the userid packet which
  70.  * matches C string userid.  Return the packet position and size.
  71.  */
  72. int getpubuserid(char *keyfile, long key_position, byte *userid,
  73.     long *userid_position, int *userid_len);
  74.  
  75. int getpubusersig(char *keyfile, long user_position, byte *sigkeyID,
  76.     long *sig_position, int *sig_len);
  77.  
  78. /* Write key control packet */
  79. void write_trust (FILE *f, byte trustbyte);
  80.  
  81. int read_trust(FILE *f, byte *keyctrl);
  82.  
  83. int ask_owntrust(char *userid, byte cur_trust);
  84.  
  85. int readkpacket(FILE *f, byte *ctb, char *userid, byte *keyID, byte *sigkeyID);
  86.  
  87. /* Show key in file f at keypos */
  88. int show_key(FILE *f, long keypos, int what);
  89.  
  90. /* possible values for 'what' */
  91. #define    SHOW_TRUST        1
  92. #define    SHOW_SIGS        2
  93. #define    SHOW_ALL        (SHOW_TRUST|SHOW_SIGS)
  94.